#!/bin/bash
# 2017-04-24
# delete section for school
#

. /usr/local/bin/logger

if [ ! -n "${1}" ] || [ ! -n "${2}" ]; then
    logger error "param error！！schoolCode & sections  are required. eg：sh delete-sction.sh BXFS001 1" 
    exit -1;
fi

read -p "确认删除$1学校的学部? y/n " confirm
if [ $confirm != 'y' ]; then
	logger "cancel operation."
	exit 0
fi
podName=`kubectl get pod | grep $1-mysql-m | awk '{print $1}'`
logger "begin to delete $1 section $2"
kubectl exec $podName /bin/bash /usr/local/data/section/delete.sh $2
